home *** CD-ROM | disk | FTP | other *** search
- Path: earth.njcc.com!is2
- From: chris@pluto.njcc.com (Chris Conway)
- Newsgroups: comp.lang.c++
- Subject: Help with cin.get()
- Date: 8 Jan 1996 05:54:50 GMT
- Organization: New Jersey Computer Connection
- Message-ID: <4cqbja$62n@earth.njcc.com>
- NNTP-Posting-Host: ts2-68.njcc.com
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- I use this function to input a book title with imbedded blanks:
-
- void getdata()
- {
- cout << "Enter title: ";
- cin.get(title, LEN);
- cout << "Enter price: ";
- cin >> price;
- }
-
- problem is, if I execute the function more than once, it skips the title input
- on the second and every subsequent execution (i.e. the line will resemble:
- Enter title: Enter price:
- never offering the oppurtunity to enter the title).
-
- I suspect this little "bug" arises from a subtle misuse of cin.get(). Can
- anyone identify it for me? This is obviously a beginner question.
-
- My thanks and apologies.
- chris.
- chris@pluto.njcc.com
-